<?php
/**
 * Created by PhpStorm.
 * User: N
 * Date: 2018/03/11
 * Time: 15:17
 */
namespace common\models;

use Yii;
use yii\base\Model;
use common\models\Models;
use backend\modules\content\models\Sitemodel;
use backend\modules\content\models\Modelfield;
use yii\db\ActiveRecord;
use yii\data\ActiveDataProvider;
use yii\data\Pagination;
use common\models\User;


/**
 * 签到模型
 * This is the model class for table "Sign".
 *
 * @property string $catid
 * @property string $siteid
 **/
class Sign extends ActiveRecord
{
     /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%sign}}';
    }





    /**
    * 验证规则
    */
    public function rules()
    {
        return [
                    
            [['uid','username','mid','addtime'],'required','message'=>'不能为空'],
           
            [['uid','mid','addtime'],'number'],   

                   
        ];
    }

    public function beforeSave($insert){
        if($insert){
           
        }else{
          
        }
      
        return true;

    }


    public function afterSave(){
        // print_r($this);
        // exit;
    }



    public function getUsers()
    {
        $users=[];
        $users=User::find()->where("branch_id={$this->id}")->orderBy(' id asc ')->all();
        return $users;
    }






    


}